package com.gee.spring.boot.oauth2.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonView;
import com.gee.spring.boot.oauth2.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *  实体类
 * 
 * </p>
 *
 * @author gee
 * @since 2020-03-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_user")
public class User extends BaseEntity<User> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    @JsonView
    private String id;

    @JsonView
    private String name;

    /**
     * 头像
     */
    @TableField("avatarUrl")
    @JsonView
    private String avatarUrl;

    @JsonView
    private String username;

    @JsonView
    private String password;

    @JsonView
    private String salt;

    @JsonView
    private String tel;

    @JsonView
    private String gender;

    /**
     * 最近一次登录时间
     */
    @TableField("lastLoginTime")
    @JsonView
    private LocalDateTime lastLoginTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}